/*
 * $Id: XLI.h,v 1.2 2006-02-10 04:08:35 bacon Exp $
 */

#ifndef _XPP_XLI_XLI_CLASS_
#define _XPP_XLI_XLI_CLASS_

#include <xpp/xli/XLIVal.h>
#include <xpp/xli/XLICell.h>
#include <xpp/xli/XLIStr.h>

namespace xpp
{
	namespace xli
	{

		class XLI: public XLIVal 
		{
		public:
			XLI ();
			~XLI ();
			
			XLICell* head () 
			{
				return this->_head;
			}

			const XLICell* head () const
			{
				return this->_head;
			}

			XLICell* tail () 
			{
				return this->_tail;
			}

			const XLICell* tail () const
			{
				return this->_tail;
			}
		
			void insert (const xp_char_t* k, const xp_char_t* v);
			void insert (const xp_char_t* k, XLIVal* val);
			void insert (XLIKey* key, XLIVal* val);
			void insert (XLICell* cell);
			int  remove (const xp_char_t* k, xp_size_t idx);
			int  remove (XLIKey* key, xp_size_t idx);
		
			XLICell* findCell (const xp_char_t* k, xp_size_t idx) const;
			XLICell* findCell (XLIKey* key, xp_size_t idx) const;
			XLIVal* findVal (const xp_char_t* k, xp_size_t idx) const;
			XLIVal* findVal (XLIKey* key, xp_size_t idx) const;
		
			xp_size_t getNkeys ();
			xp_size_t getNkeys (const xp_char_t* k);
			xp_size_t getNkeys (XLIKey* key);
		
			XLIVal* copy ();
			void    clear ();
		
			bool isStr () const
			{
				return false;
			}

			bool isList () const
			{
				return true;
			}
		
		protected:
			XLICell* _head;
			XLICell* _tail;
		};
		
	}
}

#endif
